package com.test.blog.service.impl;

import com.test.blog.entity.CategoryCountEntity;
import com.test.blog.entity.TNote;
import com.test.blog.mapper.TNoteMapper;
import com.test.blog.service.TNoteService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (TNote)表服务实现类
 *
 * @author makejava
 * @since 2021-12-09 11:51:07
 */
@Service("tNoteService")
public class TNoteServiceImpl implements TNoteService {
    @Resource
    private TNoteMapper tNoteDao;

    /**
     * 通过ID查询单条数据
     *
     * @param noteId 主键
     * @return 实例对象
     */
    @Override
    public TNote queryById(Integer noteId) {
        return this.tNoteDao.queryById(noteId);
    }

    @Override
    public List<CategoryCountEntity> count() {
        return this.tNoteDao.count();
    }

    @Override
    public List<TNote> findAll() {
        return this.tNoteDao.findAll();
    }

    @Override
    public List<TNote> findAllOrderByReadNum() {
        return this.tNoteDao.findAllOrderByReadNum();
    }

    @Override
    public int addZanNum(Integer noteId) {
        return this.tNoteDao.addZanNum(noteId);
    }

    @Override
    public int addReadNum(Integer noteId) {
        return this.tNoteDao.addReadNum(noteId);
    }

    @Override
    public List<TNote> findAllByRecommend() {
        return this.tNoteDao.findAllByRecommend();
    }

    @Override
    public List<TNote> findAllByTitle(String noteTitle) {
        return this.tNoteDao.findAllByTitle(noteTitle);
    }

    @Override
    public List<TNote> findAllByCategoryname(String categoryName) {
        return this.tNoteDao.findAllByCategoryname(categoryName);
    }
}
